package com.cc.control;

import com.cc.entity.User;
import com.cc.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: jinjinwen
 * @description: servlet
 * @date: 2021-01-12 19:30
 **/
@Controller
@RequestMapping("/my")
@CrossOrigin("*")
public class MyServlet {
    @Autowired
    private User user;
    @Autowired
    private UserServiceImpl userServiceImpl;
    @ResponseBody
    @RequestMapping("/test")
    public Map test(){
        System.out.println("MyServlet.test");
        Map m=new HashMap();
        m.put("a",11);
        return m;
    }
    /*@CrossOrigin(origins = "http://10.36.144.59:9999/")*/
    @ResponseBody
    @RequestMapping("/getUser")
    public User getUser(int id){
        user.setUserId(id);
        User t = userServiceImpl.getT(id);
        return t;
    }
}
